Page({
  data: {
    banner_list: [
      {
        pic: "https://cos3.solepic.com/20231012/b_652261202310120838248187.jpg",
      },
    ],
    functions_list: [],
  },
  onShow: function () {
    const token = wx.getStorageSync("token");
    if (!token) {
      wx.navigateTo({
        url: "/pages/logins/logins",
      });
    }
    const roleKey = wx.getStorageSync("roleKey");
    switch (roleKey) {
      case "wx_user": // 个人
      case "wx_company": // 企业
      case "wx_wuye": // 物业
        this.setData({
          functions_list: [
            {
              title: "我要报备",
              url: "/pages/report/report",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon1.png",
            },
            {
              title: "我要清运垃圾",
              url: "/pages/clean/clean",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon2.png",
            },
            {
              title: "我要退单",
              url: "/pages/cleanList/cleanList",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon3.png",
            },
            {
              title: "联系客服",
              url: "",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon4.png",
            },
          ],
        });
        break;

      case "wx_town": // 乡镇this.setData({
        this.setData({
          functions_list: [
            {
              title: "我要报备",
              url: "/pages/report/report",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon1.png",
            },
            {
              title: "联系客服",
              url: "",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon4.png",
            },
          ],
        });
        break;

      case "transport": // 运输公司
        this.setData({
          functions_list: [
            {
              title: "日常报备",
              url: "/pages/reportDaily/reportDaily",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon4.png",
            },
            {
              title: "临时报备",
              url: "/pages/reportTemporary/reportTemporary",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon4.png",
            },
          ],
        });
        break;

      case "wx_carTrans": // 五小车辆
        this.setData({
          functions_list: [
            {
              title: "订单大厅",
              url: "/pages/orderList/orderList",
              pic: "https://qingsheng.xudongfang.com//Uploads/app/icon4.png",
            },
          ],
        });
        break;
    }
  },
  handleTopage(e) {
    const { url } = e.currentTarget.dataset;
    if (url) {
      wx.navigateTo({ url });
    }
  },
});
